﻿<Serializable()> _
Public Class Vestuario
    Inherits BaseDominio

    Private _tipoVestuario As TipoVestuario
    Public Overridable Property TipoVestuario() As TipoVestuario
        Get
            Return _tipoVestuario
        End Get
        Set(ByVal value As TipoVestuario)
            _tipoVestuario = value
        End Set
    End Property


    Private  _codigo As String
    Public Overridable Property Codigo() As String
        Get
            Return _codigo
        End Get
        Set(ByVal value As String)
            _codigo = value
        End Set
    End Property


#Region "Negocio"

    Public Sub New()
        MyBase.New()
    End Sub

    Public Overridable Function Buscar(ByVal _id As Long) As Vestuario
        Return MyBase.VestuarioDao.Buscar(_id)
    End Function

    Public Overridable Sub Salvar(ByVal _tipo As TipoVestuario)

        If _tipo Is Nothing Then Throw New ArtNoiException("É preciso informar o tipo de vestuário")
        If Not _tipo.Id.HasValue Then Throw New ArtNoiException("O tipo de vestuário precisa estar persistido")

        Me.TipoVestuario = _tipo
        MyBase.VestuarioDao.Salvar(Me)
    End Sub

#End Region

End Class